package com.joshua.spring.integration.exception;

import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import lombok.Data;
import org.springframework.security.oauth2.common.exceptions.OAuth2Exception;

/**
 * com.joshua.spring.business.integration.exception -- IntegrationException
 * description: 由于spring security的认证原理是通过注册到容器tomcat的filter链上，
 * 使得认证异常不能通过DispatcherServlet，所以@ExceptionHandler处理不到
 *
 * @author <a href="mailto:joshualwork@163.com">joshua_liu</a>
 * @date 2020/1/8 10:37
 */
@Data
@JsonSerialize(using = IntegrationExceptionSerializer.class)
public class IntegrationException extends OAuth2Exception {
    private String code;
    public IntegrationException(String msg, Throwable t) {
        super(msg, t);
    }

    public IntegrationException(String msg, Throwable t, String code) {
        super(msg,t);
        this.code = code;
    }
}
